<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>学生基本信息</title>
    <link rel="stylesheet" href="../../css/reset.css">
    <link rel="stylesheet" href="../../css/BootStrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="../../css/user-info.css">
    <script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>

    <!-- 学生信息 -->
    <div class="user clearfix">
        <div class="left">
            <ul>
                <li><span>姓名：</span> <input id="name" type="text" class="form-control"  placeholder="请输入姓名"> </li>
                <li><span>学号：</span> <input id="sno" type="text" class="form-control"   readonly="readonly"></li>
                <li><span>性别：</span> <input id="sex" type="text" class="form-control"  placeholder="请输入性别"></li>
                <li><span>年龄：</span> <input id="age" type="text" class="form-control"  placeholder="请输入年龄"></li>
                <li><span>联系电话：</span> <input id="tel" type="text" class="form-control"  placeholder="请输入联系电话"></li>
                <li><span>电子邮箱：</span> <input id="email" type="text" class="form-control"  placeholder="请输入E-mail"></li>
            </ul>
        </div>

        <div class="center">
            <img class="img" src="../../picture/touxiang2.jpeg"></img>
        </div>
        <div class="bbtn">
            <input id="updateHandle" type="button" class="btn btn-info" value="修改">
        </div>
    </div>
</body>
<script>
    $.ajax({
        url:"/RuanJianKeShe/getStudentInfoBySno",
        type:"post",
        data:{
            "msg":"getStudentInfoBySno"
        },
        dataType:"json",
        success:function(data){
            $("#name").attr("value",data.info.sname);
            $("#sno").attr("value",data.info.sno);
            $("#sex").attr("value",data.info.ssex);
            $("#age").attr("value",data.info.sage);
            $("#tel").attr("value",data.info.telephone);
            $("#email").attr("value",data.info.email);
        },error: function () {
        }
    })
    $("#updateHandle").click(function () {
        var name = $("#name").val();
        var sno = $("#sno").val();
        var sex = $("#sex").val();
        var age = $("#age").val();
        var telephone = $("#tel").val();
        var email = $("#email").val();
        $.ajax({
            url:"/RuanJianKeShe/updateStudentInfo",
            type:"post",
            data:{
                "msg":"updateStudentInfo",
                "name":name,
                "sno":sno,
                "sex":sex,
                "age": age,
                "telephone":telephone,
                "email":email
            },
            dataType:"json",
            success:function(success){
                alert(success)
            },
            error:function(){
                alert("fail");
            }
        })
    })

</script>
</html>